04_DEEP_INTERNAL_ANALYSIS PORTAL
Week 2 Arrays · Dual Sovereign Core (AR / EN)
⚑ SILICON HARDWARE MAP & HEX GRIDS
AYMAN ELMASRY
Computational Creative Director · AI Prompt Engineer
Founder of Ayman Elmasry LLC
πŸ”’ ⚑ AEL Sovereign Seal (Active Master Verification)
{
  "ael_seal": "AEL CS Encyclopedia β€” Β© Ayman Elmasry",
  "owner": "Ayman Elmasry",
  "legal_entities": [
    "Ayman Elmasry LLC (UAE)",
    "Ayman Elmasry Advertising & Marketing (Egypt)"
  ],
  "syllabus_source": "Harvard CS50x 2026-2027",
  "domain": "Week 2: Memory Physics & Low-Level Buffers",
  "document_type": "04_Deep_Internal_Analysis",
  "methodology": "8-Stage Sub-Silicon Execution Paradigm",
  "system_version": "v3.0"
}

Week 2 Deep Internal Analysis: Memory Physics & Hex Grids

Section 1: Memory Physics & Hexadecimal Grid Mechanics

Peering beneath the operational layer of the operating system kernel (Under the Hood), we discover that Random Access Memory (RAM) functions physically as an immense matrix of byte-sized memory cells. Each discrete cell consists of micro-transistors and capacitors holding electrical charge states representing physical 0s and 1s. To differentiate these individual cells, the CPU allocates a unique numerical identifier to every byte, canonically represented in hexadecimal notation, such as 0x120, 0x121, 0x122.

===================================================================================
             DEEP HARDWARE MEMORY MAP (HEXADECIMAL ALLOCATION)
===================================================================================

  [ Address: 0x100 ] ──> int (Byte 1)  ┐
  [ Address: 0x101 ] ──> int (Byte 2)  β”œβ”€ 4 Contiguous Bytes (e.g., scores[0])
  [ Address: 0x102 ] ──> int (Byte 3)  β”‚
  [ Address: 0x103 ] ──> int (Byte 4)  β”˜
  [ Address: 0x104 ] ──> char (Byte 1) ──> 1 Byte (e.g., 'H')
  [ Address: 0x105 ] ──> char (Byte 2) ──> 1 Byte (e.g., 'I')
  [ Address: 0x106 ] ──> char (Byte 3) ──> 1 Byte (e.g., '\0' Null Terminator)

===================================================================================
  • Contiguous Memory Allocation of Arrays: In bare-metal C, an array is not an encapsulated object; rather, it acts fundamentally as a direct pointer referencing the base address of its initial element.
  • Pointer Offset Calculation: When evaluating an indexed access such as scores[2], the CPU dynamically computes the absolute target address using the base address and data type size offset.

Section 2: Deep String Anatomy & Pointer Deconstruction

In bare-metal C architecture, a string is literally implemented as a char * (a memory pointer holding the base address of a character array).

===================================================================================
             DEEP STRING POINTER EXECUTION MATRIX
===================================================================================

  string s = "HI!"; (CS50 wrapper)  ──>  char *s = "HI!"; (Bare metal C)
  
  [ Pointer s ] ──> Holds address 0x104
                       β”‚
                       β–Ό
       [ 0x104: 'H' ] ──> [ 0x105: 'I' ] ──> [ 0x106: '!' ] ──> [ 0x107: '\0' ]

===================================================================================
  • The Critical Function of \0: Because the bare-metal compiler retains no runtime metadata tracking array length, the null terminator \0 serves as the sole physical boundary preventing the CPU from performing a buffer over-read into adjacent memory domains.
  • Physical Execution of strlen: The standard library function strlen executes a linear while loop that increments an internal pointer across consecutive memory addresses until encountering the exact byte value 0. Consequently, the time complexity of string length evaluation is strictly O(n).

Section 3: Mathematical Parsing Analysis & Cryptography

The Coleman-Liau index computes academic reading levels utilizing a mathematical formulation tracking average letters and sentences per 100 words.

  • Caesar Cipher Mathematical Mechanics: The cryptographic transformation relies on strict modular arithmetic c = (p + k) % 26.